// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

#nullable restore

using Elastic.Clients.Elasticsearch.Serverless.Fluent;
using Elastic.Clients.Elasticsearch.Serverless.Requests;
using Elastic.Clients.Elasticsearch.Serverless.Serialization;
using Elastic.Transport;
using Elastic.Transport.Extensions;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text.Json;
using System.Text.Json.Serialization;

namespace Elastic.Clients.Elasticsearch.Serverless.MachineLearning;

public sealed partial class UpgradeJobSnapshotRequestParameters : RequestParameters
{
	/// <summary>
	/// <para>
	/// Controls the time to wait for the request to complete.
	/// </para>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Serverless.Duration? Timeout { get => Q<Elastic.Clients.Elasticsearch.Serverless.Duration?>("timeout"); set => Q("timeout", value); }

	/// <summary>
	/// <para>
	/// When true, the API won’t respond until the upgrade is complete.
	/// Otherwise, it responds as soon as the upgrade task is assigned to a node.
	/// </para>
	/// </summary>
	public bool? WaitForCompletion { get => Q<bool?>("wait_for_completion"); set => Q("wait_for_completion", value); }
}

/// <summary>
/// <para>
/// Upgrade a snapshot.
/// Upgrades an anomaly detection model snapshot to the latest major version.
/// Over time, older snapshot formats are deprecated and removed. Anomaly
/// detection jobs support only snapshots that are from the current or previous
/// major version.
/// This API provides a means to upgrade a snapshot to the current major version.
/// This aids in preparing the cluster for an upgrade to the next major version.
/// Only one snapshot per anomaly detection job can be upgraded at a time and the
/// upgraded snapshot cannot be the current snapshot of the anomaly detection
/// job.
/// </para>
/// </summary>
public sealed partial class UpgradeJobSnapshotRequest : PlainRequest<UpgradeJobSnapshotRequestParameters>
{
	public UpgradeJobSnapshotRequest(Elastic.Clients.Elasticsearch.Serverless.Id jobId, Elastic.Clients.Elasticsearch.Serverless.Id snapshotId) : base(r => r.Required("job_id", jobId).Required("snapshot_id", snapshotId))
	{
	}

	internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningUpgradeJobSnapshot;

	protected override HttpMethod StaticHttpMethod => HttpMethod.POST;

	internal override bool SupportsBody => false;

	internal override string OperationName => "ml.upgrade_job_snapshot";

	/// <summary>
	/// <para>
	/// Controls the time to wait for the request to complete.
	/// </para>
	/// </summary>
	[JsonIgnore]
	public Elastic.Clients.Elasticsearch.Serverless.Duration? Timeout { get => Q<Elastic.Clients.Elasticsearch.Serverless.Duration?>("timeout"); set => Q("timeout", value); }

	/// <summary>
	/// <para>
	/// When true, the API won’t respond until the upgrade is complete.
	/// Otherwise, it responds as soon as the upgrade task is assigned to a node.
	/// </para>
	/// </summary>
	[JsonIgnore]
	public bool? WaitForCompletion { get => Q<bool?>("wait_for_completion"); set => Q("wait_for_completion", value); }
}

/// <summary>
/// <para>
/// Upgrade a snapshot.
/// Upgrades an anomaly detection model snapshot to the latest major version.
/// Over time, older snapshot formats are deprecated and removed. Anomaly
/// detection jobs support only snapshots that are from the current or previous
/// major version.
/// This API provides a means to upgrade a snapshot to the current major version.
/// This aids in preparing the cluster for an upgrade to the next major version.
/// Only one snapshot per anomaly detection job can be upgraded at a time and the
/// upgraded snapshot cannot be the current snapshot of the anomaly detection
/// job.
/// </para>
/// </summary>
public sealed partial class UpgradeJobSnapshotRequestDescriptor : RequestDescriptor<UpgradeJobSnapshotRequestDescriptor, UpgradeJobSnapshotRequestParameters>
{
	internal UpgradeJobSnapshotRequestDescriptor(Action<UpgradeJobSnapshotRequestDescriptor> configure) => configure.Invoke(this);

	public UpgradeJobSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.Serverless.Id jobId, Elastic.Clients.Elasticsearch.Serverless.Id snapshotId) : base(r => r.Required("job_id", jobId).Required("snapshot_id", snapshotId))
	{
	}

	internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningUpgradeJobSnapshot;

	protected override HttpMethod StaticHttpMethod => HttpMethod.POST;

	internal override bool SupportsBody => false;

	internal override string OperationName => "ml.upgrade_job_snapshot";

	public UpgradeJobSnapshotRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Serverless.Duration? timeout) => Qs("timeout", timeout);
	public UpgradeJobSnapshotRequestDescriptor WaitForCompletion(bool? waitForCompletion = true) => Qs("wait_for_completion", waitForCompletion);

	public UpgradeJobSnapshotRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Serverless.Id jobId)
	{
		RouteValues.Required("job_id", jobId);
		return Self;
	}

	public UpgradeJobSnapshotRequestDescriptor SnapshotId(Elastic.Clients.Elasticsearch.Serverless.Id snapshotId)
	{
		RouteValues.Required("snapshot_id", snapshotId);
		return Self;
	}

	protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
	{
	}
}